package HashMap;

import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class test2 {
    public static void main(String[] args) {
        TreeMap<Student,String> tm = new TreeMap<>();
        Student s1 = new Student("张三",23);
        Student s2 = new Student("李四",24);
        Student s3 = new Student("王五",25);
        Student s4 = new Student("张三",23);
        tm.put(s1,"北京");
        tm.put(s2,"上海");
        tm.put(s3,"重庆");
        Set<Map.Entry<Student, String>> entries = tm.entrySet();
        for (Map.Entry<Student, String> entry : entries) {
            Student s = entry.getKey();
            System.out.println(s.getName()+s.getAge());
            System.out.println(entry.getValue());

        }


        System.out.println(tm);
    }
}
